package com.example.shopping.config;

public class Validator {
    public static boolean validateAccount(String account) {
        return account.matches("^[A-Za-z][A-Za-z0-9]{5,9}$");
    }
    public static boolean validatePassword(String password) {
        //以大写字母开头，后面跟5到9位的数字或字母或_
        return password.matches("^[A-Z][A-Za-z0-9_]{5,9}$");
    }
    //验证手机号
    public static boolean validatePhone(String phone) {
        return phone.matches("^1[0-9]{10}$");
    }

    //验证类别名，2-5位
    public static boolean validateCategoryName(String name) {
        return name.matches("^.{2,5}$");
    }
}

